]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Calendar: sort multi-day events by ending day/time
authorAndreas Brauchli <a.brauchli@elementarea.net>
Thu, 18 Sep 2014 01:34:40 +0000 (15:34 -1000)
committerMichael Catanzaro <mcatanzaro@gnome.org>
Mon, 27 Oct 2014 20:31:32 +0000 (15:31 -0500)
With commit dc6a60dde, the calendar displays the ending day and time of
a continuing multi-day event on its ending day. This results in the list
not appearing to be sorted. This patch sorts the list according to the
displayed day/time.

With the two appointments
Thursday 0800-1000 Foo, and Wednesday 0900-Friday 1200 Bar and today
being Monday, the rest of the week list currently displays:
F ...1200 Bar
T    0800 Foo
With this patch, the displaying order is switched because Friday comes
after Thursday.

https://bugzilla.gnome.org/show_bug.cgi?id=727302

js/ui/calendar.js

index 3899ecb8155ca1fca48d0f35cdc7e01f860138a2..2c436890107eeadecfa44acca2061feb9e255d59 100644 (file)
@@ -383,6 +383,12 @@ const DBusEventSource = new Lang.Class({
                 result.push(event);
             }
         }
+        result.sort(function(event1, event2) {
+            // sort events by end time on ending day
+            let d1 = event1.date < begin && event1.end <= end ? event1.end : event1.date;
+            let d2 = event2.date < begin && event2.end <= end ? event2.end : event2.date;
+            return d1.getTime() - d2.getTime();
+        });
         return result;
     },